home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-02-08 | 3.4 KB | 86 lines | [TEXT/KAHL] |
- NAME
- mkptypes - make prototypes for functions
-
-
- SYNOPSIS
- mkptypes [ -e ][ -n ][ -p symbol ][ -s ][ -x ][ -z ][ -A ] [ file ... ]
-
-
- DESCRIPTION
- Mkptypes takes as input one or more C source code files, and produces as
- output (on the standard output stream) a list of function prototypes (a
- la ANSI) for the external functions defined in the given source files. This
- output, redirected to a file, is suitable for #include'ing in a C source
- file. The function definitions in the original source may be either "old-
- style" (in which case appropriate prototypes are generated for the funct-
- ions) or "new-style" (in which the definition includes a prototype already).
-
- The -e option causes the "extern" keyword to be explicitly printed for
- external functions. Some non-ANSI compilers may need this.
-
- The -n option causes the line number where each function was defined to
- be prepended to the prototype declaration as a comment.
-
- The -p option controls the name of the macro used to guard prototype
- definitions. Normally this is "_P", but you can change it to any string you
- like. To eliminate the guard macro entirely, use the -A option.
-
- The -s option causes prototypes to be generated for functions declared
- "static" as well as extern functions.
-
- The -x option causes parameter names to be omitted from the output proto-
- types. This may be necessary for some brain-damaged pseudo-ANSI com-
- pilers. You may also prefer this style of output. This option has not been
- thoroughly tested.
-
- The -z option suppresses the definition of the prototype macro given by -p.
- Header files generated by mkptypes with this option will not work unless
- the prototype macro has been defined elsewhere in the program by the user.
- Used with the -p option, the -z option allows use of predefined prototype
- hiding macros that may exist on some systems.
-
- The -A option causes the prototypes emitted to be only readable by ANSI
- compilers. Normally, the prototypes are "macro-ized" so that compilers
- with __STDC__not defined don't see them.
-
- If files are specified on the command line, then a comment specifying the
- file of origin is emitted before the prototypes constructed from that file.
- If no files are given, then no comments are emitted and the C source code
- is taken from the standard input stream.
-
- BUGS
- Mkptypes is easily confused by complicated declarations, such as
-
- int ((*signal)())() f ...
- or
-
- struct foo f int x, y; g foofunc() f ...
-
- This is because the program doesn't actually understand type definitions.
- Some programs may need to be run through the preprocessor before being
- run through mkptypes . The -n option will not work correctly on prepro-
- cessor output if function definitions (as opposed to declarations) appear
- in header files.
-
- Typedef'd types aren't correctly promoted, e.g. for
-
- typedef schar char; int foo(x) schar x;...
- mkptypes incorrectly generates the prototype int foo(schar x) rather than
- the [correct] int foo(int x).
-
- Functions named "inline" with no explicit type qualifiers are not recog-
- nized.
-
-
- SEE ALSO
- cc (1), lint (1).
-
-
- AUTHOR
- Eric R. Smith <ersmith@uwovax.uwo.ca>
-
-
- NOTE
- There is no warranty for this program (as noted above, it's guaranteed to
- break sometimes anyways!). Mkptypes is in the public domain.
-